package com.xhh.nphm.web.controller.system;

import com.xhh.nphm.common.core.controller.BaseController;
import com.xhh.nphm.common.core.page.TableDataInfo;
import com.xhh.nphm.system.domain.TwfDeferEty;
import com.xhh.nphm.system.service.ITWfDeferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/twfDefer")
public class TwfDeferController extends BaseController {
    private String prefix = "system/twfDefer";

    @Autowired
    private ITWfDeferService itWfDeferService;
    /**
     * 延期列表页面
     * @param wfId
     * @param map
     * @return
     */
    @GetMapping("/deferList/{wfId}")
    public ModelAndView deferList(@PathVariable Integer wfId, ModelMap map) {
        map.put("wfId", wfId);
        return new ModelAndView(prefix+"/deferList");
    }

    /**
     * 延期列表数据
     * @param wfId
     * @return
     */
    @PostMapping("deferListJson/{wfId}")
    public TableDataInfo deferListJson(@PathVariable Integer wfId) {
        startPage();
        List<Map<String,Object>> list=itWfDeferService.deferListJson(wfId);
        return getDataTable(list);
    }
    /**
     * 延期 详情页面
     * @param
     * @param map
     * @return
     */
    @GetMapping("/deferDetail/{pkId}")
    public ModelAndView deferDetail(@PathVariable Integer pkId, ModelMap map) {
        TwfDeferEty twfDeferEty = itWfDeferService.getById(pkId);
        map.put("twfDefer",twfDeferEty);
        return new ModelAndView(prefix+"/deferDetail");
    }
}
